<?php

namespace app\common\validate;
use think\Validate;

class Site extends Validate
{
    /**
     * 正则
     */
    protected $regex = ['format' => '[a-z0-9_]+'];

    /**
     * 验证规则
     */
    protected $rule = [
        'name' => 'require|min:2|max:30|format|unique:Site,name'
    ];
    /**
     * 提示消息
     */
    protected $message = [
    ];

    /**
     * 字段描述
     */
    protected $field = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['name'],
        'edit' => ['name'],
    ];

    public function __construct(array $rules = [], array $message = [], array $field = [])
    {
        $this->field = [
            'name'          => __('Name')
        ];

        parent::__construct($rules, $message, $field);
    }

}
